MAKEFLAGS+=--quiet
BINNAME=bin/blockdropper
OBJDIR=obj/
SRCDIR=src
SRCFILES=${SRCDIR}/main.cpp \
         ${SRCDIR}/ActionRecord.cpp \
         ${SRCDIR}/BlockDropperGame.cpp \
         ${SRCDIR}/BlockDropperManager.cpp \
         ${SRCDIR}/BlockDropperUI.cpp \
         ${SRCDIR}/FreeBlock.cpp \
         ${SRCDIR}/GameManager.cpp \
         ${SRCDIR}/SDLDisplaySurface.cpp \
         ${SRCDIR}/SDLInitialiser.cpp \
         ${SRCDIR}/SDLTimer.cpp \
         ${SRCDIR}/SDLVideoOutput.cpp \
         ${SRCDIR}/Timer.cpp \
         ${SRCDIR}/VideoOutput.cpp \

OBJFILES=$(patsubst ${SRCDIR},${OBJDIR},$(patsubst %.cpp,%.o,$(SRCFILES)))

CPPFLAGS=-Wall -Werror -Weffc++ -W -pedantic-errors -std=c++11 -I${SRCDIR} `sdl-config --cflags`

all: ${BINNAME}

${BINNAME}: ${OBJFILES}
	g++ -o ${BINNAME} ${OBJFILES} `sdl-config --libs` -lSDL_gfx

$(OBJDIR)/%.o: ${SRCDIR}/%.cpp
	g++ $(CPPFLAGS) $(CPPFLAGS) -c $@ $<

clean:
	rm -f ${OBJFILES}

check: ${SRCFILES}
	cppcheck --enable=all  src/*cpp > /dev/null
